#!/bin/bash
# 练习if操作
red="\033[31m"
green="\033[32m"
end="\033[0m"
if [[ -z "$1" ]]
then
    echo -e "${red}错误!缺少参数${end}"    
    echo -e "usage:$0 ip"
    exit 1
fi

if ping -c 1 -W 2 -q $1  &>/dev/null ; then
    echo "网络通畅"
else
    echo "无法连接$1"
fi
